﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StreamReader1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string line;
            try
            {
                FileStream af = new FileStream("../../program.cs", FileMode.Open);
                StreamReader   sr=new StreamReader(af);

                line = sr.ReadLine();
                while (line != null)
                {
                    Console.WriteLine(line);
                    line = sr.ReadLine();
                }
                sr.Close();
                af.Close();
                Console.WriteLine("=============================================");
                foreach (string str in File.ReadLines("../../program.cs"))
                {
                    Console.WriteLine(str);
                }
                Console.ReadKey();
            }
            catch (Exception a)
            {

                Console.WriteLine(a.Message);
                Console.ReadKey();
                return;
            }

        }
    }
}
